<template>
  <div>
    <svg :style="{ width, height }" :class="class" :fill="color">
      <use :xlink:href="prefix + name"></use>
    </svg>
  </div>
</template>

<script setup lang="ts">
//接受父组件传递过来的参数
defineProps({
  //复杂写法
  //xlink:href属性值前缀
  prefix: {
    type: String,
    default: "#icon-",
  },
  //图标的名字
  name: String,
  //接受父组件传递过来的颜色
  color: {
    type: String,
    default: "",
  },
  //接受父组件传递过来宽度
  width: {
    type: String,
    default: "16px",
  },
  //接受父组件传递过来的高度
  height: {
    type: String,
    default: "16px",
  },
  class: {
    type: String,
    default: "icon",
  },
});
</script>

<style scoped>
.sv {
  width: 60px;
  height: 60px;
}
</style>
